package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.SouSuoHomeBean;

import java.util.List;

/**
 * Created by 001 on 2017/9/26.
 */

public class SouSuoHomeAdapter extends RecyclerView.Adapter<SouSuoHomeAdapter.ViewHolder> {

    private Context mContext;
    private List<SouSuoHomeBean> mList;

    public SouSuoHomeAdapter(Context mContext,List<SouSuoHomeBean> mList) {
        this.mContext = mContext;
        this.mList = mList;
    }

    @Override
    public SouSuoHomeAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        View view = LayoutInflater.from(mContext).inflate(R.layout.adapter_sou_suo_home, parent, false);

        ViewHolder holder = new ViewHolder(view);

        return holder;
    }

    @Override
    public void onBindViewHolder(SouSuoHomeAdapter.ViewHolder holder, int position) {

        SouSuoHomeBean bean = mList.get(position);

        holder.tv_name.setText(bean.name);
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        TextView tv_name;

        public ViewHolder(View itemView) {
            super(itemView);

            tv_name = (TextView) itemView.findViewById(R.id.tv_name);
        }
    }
}
